switch (state) {
  case 0:
    LOAD(linkUrl);
  case 1:
    // get image src using xpath expression
    var expr = "//img[@foo='bar']/@src";
    var image_src = TD_xpath(expr, "string");
    // or if you don't want to use TD_xpath() shorthand function:
    //var image_src = document.evaluate(expr, document, null, XPathResult.STRING_TYPE, null).stringValue;
    RETURN(image_src);
}